from login import login, login1,atm_1, verify
import os
def atm():
    file_name = "atm_info.txt"
    if not os.path.isfile(file_name):
        with open(file_name, "w") as file:
            file.write("")
            file.seek(0)
    while True:
        choice = input("#用户界面\n1,登录\n2,注册\n3,退出\n请选择你的操作：")
        if choice == "1":
            name = input("登录|请输入用户名（q为返回上一级）")
            if name == "q":
                continue
            passwd = input("请输入密码：")
            if login1(name, passwd):
                print("登录成功")
                atm_1(name)
            else:
                print("用户名或密码错误请重新输入")
        elif choice == "2":
            name = input("注册|请输入用户名（q为返回上一级）")
            if name == "q":
                continue
            passwd = input("请输入密码：")
            if verify(name) == True:
                print("用户已存在")
                continue
            if login(name, passwd):
                print("注册成功！")
                continue
        elif choice == "3":
            break
        else:
            print("请输入正确选项")

atm()

